package com.arqui.admmon_module.client.core.main;

import com.gwtplatform.mvp.client.ViewImpl;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.user.client.ui.Widget;
import com.google.inject.Inject;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ScrollPanel;

public class EventsView extends ViewImpl implements EventsPresenter.MyView {

	private final Widget widget;
	
	@UiField Button loadB;
	@UiField Button servicesB;
	@UiField Button invalidB;
	@UiField ScrollPanel contentPanel;

	public interface Binder extends UiBinder<Widget, EventsView> {
	}

	@Inject
	public EventsView(final Binder binder) {
		widget = binder.createAndBindUi(this);
	}

	@Override
	public Widget asWidget() {
		return widget;
	}
	
	public Button getLoadB() {
		return loadB;
	}

	public void setLoadB(Button loadB) {
		this.loadB = loadB;
	}

	public Button getServicesB() {
		return servicesB;
	}

	public void setServicesB(Button servicesB) {
		this.servicesB = servicesB;
	}

	public Button getInvalidB() {
		return invalidB;
	}

	public void setInvalidB(Button invalidB) {
		this.invalidB = invalidB;
	}

	public ScrollPanel getContentPanel() {
		return contentPanel;
	}

	public void setContentPanel(ScrollPanel contentPanel) {
		this.contentPanel = contentPanel;
	}
	
	@Override
	public void setInSlot(Object slot, Widget content) {
		if(slot == EventsPresenter.SLOT_content){
			contentPanel.clear();
			
			if(content != null){
				contentPanel.add(content);
			}
		}else{
			super.setInSlot(slot, content);
		}
	}
}